package org.fioma.tree.suffixTree.memory;

import org.fioma.tree.LabelFactory;
import org.fioma.tree.Node;
import org.fioma.tree.bytes.LabelRefBytes;

public abstract class SuffixNodeFactoryMemoryBytes<I extends InternalSuffixNodeMemory<LabelRefBytes, I, F>, F extends LeafSuffixNodeMemory<LabelRefBytes, I, F>>
		implements SuffixNodeFactoryMemory<LabelRefBytes, I, F> {

	public final static int MAXIMUM_ARRAY_SIZE = Integer.MAX_VALUE - 8;

//	Queue<byte[]> labelPool = new LinkedList<byte[]>();
	byte[][] nodes;

	public SuffixNodeFactoryMemoryBytes(long nodesSize, int labelSize, LabelFactory<LabelRefBytes> labelFactory) {
		for (int i = 0; i < labelSize; i++) {
//			labelPool.offer(new )
		}
	}

	public byte getByte(long pos) {

	}

	public boolean isLeaf(long pos) {

	}

	public long getAddress(long location) {

	}

	@Override
	public Node<LabelRefBytes, I, F> getNode(long pos) {
		if (pos == 0) {
			return null;
		}
		Node<LabelRefBytes, I, F> ret;
		if (!isLeaf(pos)) {
			ret = createObjectInternalNode(pos);
		} else {
			ret = createObjectLeaf(pos);
		}
		return ret;
	}

	@Override
	public Node<LabelRefBytes, I, F>[] getChilds(long pos) {
		long[] childsAddresses = getChildsAddresses(pos);
		int length = childsAddresses.length;
		Node<LabelRefBytes, I, F>[] ret = new Node[length];
		for (int i = 0; i < length; i++) {
			ret[i] = getNode(childsAddresses[i]);
		}
		return ret;
	}

	@Override
	public Node<LabelRefBytes, I, F> getChild(long pos, byte letter) {
		long childAddress = getChildAddress(pos, letter);
		return getNode(childAddress);
	}

	@Override
	public void setChild(long pos, byte letter, Node<LabelRefBytes, I, F> child) {
		// TODO Auto-generated method stub

	}

	@Override
	public LabelRefBytes getLabel(long pos) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setLabel(long pos, LabelRefBytes label) {
		// TODO Auto-generated method stub

	}

	@Override
	public I getParent(long pos) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setParent(long pos, I parent) {
		// TODO Auto-generated method stub

	}

	@Override
	public long allocMemoryInternalNode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public long allocMemoryLeafNode() {
		// TODO Auto-generated method stub
		return 0;
	}

}
